const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const moduleConfig = require('./module.js');
const webpack = require('webpack');
const srcPath=path.join(__dirname, '../src');
module.exports = {
    // devtool: 'inline-source-map',
    entry: path.join(__dirname,"../src/index.js"), //已多次提及的唯一入口文件
    output: {
        path: path.join(__dirname, '/../dist'), //打包后的文件存放的地方
        filename: "bundle.js", //打包后输出文件的文件名
        publicPath: ""// 输出解析文件的目录，url 相对于 HTML 页面
    },
    module: moduleConfig,
    resolve: {
        extensions: [".js", ".json", ".jsx", ".css"],
        alias: {
          actions: `${srcPath}/actions/`,
          components: `${srcPath}/components/`,
          sources: `${srcPath}/sources/`,
          stores: `${srcPath}/stores/`,
          styles: `${srcPath}/styles/`
        }
    },
    // 在配置中添加插件
    plugins: [
      // 构建优化插件
      new HtmlWebpackPlugin({
        filename:'index.html',
        template:'src/index.html'
      }),
      new webpack.HotModuleReplacementPlugin()

    ]
    
}